﻿<Window x:Class="UIAuth.Examples.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:VM="clr-namespace:UIAuth.Examples.VM" xmlns:AuthInfrastructure="clr-namespace:UIAuth.Common;assembly=UIAuth.Common" Title="MainWindow" Height="350" Width="525">
	<Grid>
		<Grid.Resources>
			<DataTemplate x:Key="normal">
				<StackPanel Orientation="Horizontal">
					<TextBox Text="{Binding FirstName}" />
					<TextBox Text="{Binding Mail}" />
				</StackPanel>
			</DataTemplate>
			<DataTemplate x:Key="readonly">
				<StackPanel Orientation="Horizontal">
					<TextBlock Text="{Binding FirstName}" />
					<TextBlock Text="{Binding Mail}" />
				</StackPanel>
			</DataTemplate>
		</Grid.Resources>
		<Grid.DataContext>
			<VM:PeoplesVM />
		</Grid.DataContext>
		<Grid.RowDefinitions>
			<RowDefinition Height="27*" />
			<RowDefinition Height="284*" />
		</Grid.RowDefinitions>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="161*" />
			<ColumnDefinition Width="239*" />
			<ColumnDefinition Width="103*" />
		</Grid.ColumnDefinitions>
		<ListBox Grid.Row="1" Name="listBox1" ItemsSource="{Binding InvisiblePeoples}">
			<ListBox.ItemTemplate>
				<DataTemplate>
					<StackPanel Orientation="Horizontal">
						<TextBox Text="{Binding FirstName}" />
						<TextBox Text="{Binding Mail}" />
					</StackPanel>
				</DataTemplate>
			</ListBox.ItemTemplate>
			<i:Interaction.Behaviors>
				<AuthInfrastructure:AuthBehavior VMBounded="{Binding InvisiblePeoples}" />
			</i:Interaction.Behaviors>
		</ListBox>

		<ListBox x:Name="listBox" Grid.Row="1" Grid.Column="1" ItemsSource="{Binding ReadOnlyPeopele}" Margin="0,0,93,167">
			<ListBox.ItemTemplate>
				<DataTemplate>
					<Grid>
						<StackPanel Orientation="Horizontal">
							<TextBox Text="{Binding FirstName}" />
							<TextBox Text="{Binding Mail}" />
						</StackPanel>
					</Grid>
				</DataTemplate>

			</ListBox.ItemTemplate>
			<i:Interaction.Behaviors>
				<AuthInfrastructure:AuthBehavior DTemplateName="readonly" VMBounded="{Binding ReadOnlyPeopele}" DTemplate="ItemTemplate" />
			</i:Interaction.Behaviors>
		</ListBox>
		<ListBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding ReadOnlyPeopele}" Margin="0,155,93,12">
			<ListBox.ItemTemplate>
				<DataTemplate>
					<Grid>
						<StackPanel Orientation="Horizontal">
							<TextBox Text="{Binding FirstName}" />
							<TextBox Text="{Binding Mail}" />
						</StackPanel>
					</Grid>
				</DataTemplate>

			</ListBox.ItemTemplate>
			<i:Interaction.Behaviors>
				<AuthInfrastructure:AuthBehavior VMBounded="{Binding ReadOnlyPeopele}" DTemplate="ItemTemplate">
					<AuthInfrastructure:AuthBehavior.ReadOnlyTemplate>
						<DataTemplate>
							<Border Background="Yellow" CornerRadius="4" Margin="3,3,3,3">
								<StackPanel Orientation="Vertical">
									<TextBlock Text="{Binding FirstName}" />
									<TextBlock Text="{Binding Mail}" />
								</StackPanel>
							</Border>
						</DataTemplate>
					</AuthInfrastructure:AuthBehavior.ReadOnlyTemplate>
				</AuthInfrastructure:AuthBehavior>
			</i:Interaction.Behaviors>
		</ListBox>
		<Button Content="All" Grid.Column="2" Grid.Row="1" Height="23" HorizontalAlignment="Left" Margin="0,1,0,0" Name="button1" VerticalAlignment="Top" Width="75" Command="{Binding ShowMbox}" />

		<Button Command="{Binding EntireVM}" Content="Entire view model" Height="23" HorizontalAlignment="Left" Margin="0,89,0,0" Name="button2" VerticalAlignment="Top" Width="103" Grid.Column="2" Grid.Row="1">
			<i:Interaction.Behaviors>
				<AuthInfrastructure:AuthBehavior VMBounded="{Binding}" />
			</i:Interaction.Behaviors>
		</Button>

		<Button Command="{Binding DisableBtn}" Content="Disable button" Height="23" HorizontalAlignment="Left" Margin="0,45,0,0" VerticalAlignment="Top" Width="91" Grid.Column="2" Grid.Row="1">
			<i:Interaction.Behaviors>
				<AuthInfrastructure:AuthBehavior VMBounded="{Binding DisableBtn}" />
			</i:Interaction.Behaviors>
		</Button>
		<CheckBox Content="CheckBox" Grid.Column="2" Grid.Row="1" Height="16" HorizontalAlignment="Left" Margin="14,137,0,0" Name="checkBox1" VerticalAlignment="Top" IsHitTestVisible="False" />
	</Grid>
</Window>